from flask import jsonify


def ok_resp(data=None, message='ok', code=0, http_status_code=200):
    result = jsonify({'code': code, 'data': {} if data is None else data, 'message': message})
    result.status_code = http_status_code
    return result


def fail_resp(code, message=None, data=None, http_status_code=200):
    result = jsonify({'code': code, 'data': {} if data is None else data, 'message': message})
    result.status_code = http_status_code or 200
    return result
